Fix ubuntu test failures: ExcelStyleDateFormatter seconds rounding + SixLabors.Fonts resilience#1708
Closed
Copilot wants to merge 4 commits into
Closed
Fix ubuntu test failures: ExcelStyleDateFormatter seconds rounding + SixLabors.Fonts resilience#1708Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…ormat pattern Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ExcelStyleDateFormatter for seconds formatting
Fix ExcelStyleDateFormatter: round seconds when milliseconds absent from format pattern
Mar 1, 2026
…leDateFormatter The previous commit added rounding logic that rounds seconds up when ms >= 500 and the format pattern doesn't include a milliseconds specifier. However, Excel actually truncates (floors) to the nearest second. This broke TestBug60031 and TestElapsedTime. Changes: - Remove incorrect rounding block from ExcelStyleDateFormatter.cs - Update TestSecondsTruncationWithoutMilliseconds (renamed from TestSecondsRoundingWithoutMilliseconds) to expect truncation behavior (07 not 08) Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
Copilot
AI
changed the title
Fix ExcelStyleDateFormatter: round seconds when milliseconds absent from format pattern
Fix ubuntu CI failures: revert incorrect seconds rounding in ExcelStyleDateFormatter
Mar 9, 2026
…nts resilience, test updates Co-authored-by: tonyqus <772561+tonyqus@users.noreply.github.com>
Copilot
AI
changed the title
Fix ubuntu CI failures: revert incorrect seconds rounding in ExcelStyleDateFormatter
Fix ubuntu test failures: ExcelStyleDateFormatter seconds rounding + SixLabors.Fonts resilience
Mar 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NPOI was truncating sub-second values when formatting dates without a milliseconds specifier, while Excel rounds to the nearest second (e.g.
02:34:07.550→02:34:08). Additionally, on Linux systems with a brokenNotoColorEmoji.ttf(missinglocatable),SixLabors.FontsthrowsMissingFontTableExceptionduring text measurement, crashing AutoSize and cell height calculations.ExcelStyleDateFormatter: round seconds when no ms specifier
In
ExcelStyleDateFormatter.Format(), rounddateup to the nearest second when:f,F,.0,.00,.000)[h],[m],[s], etc.) — elapsed-time formats derive hours/minutes/seconds directly from the raw double, so rounding theDateTimewould corrupt the non-elapsed portionsSixLabors.Fonts: tolerate broken system fonts on Linux
IFont2FontImpl: When no requested or Arial font is found, probe candidate system fonts with a test measurement and skip any that throwInvalidFontFileException(e.g.NotoColorEmojiwith a missinglocatable).GetDefaultCharWidth/GetCellWidth/GetContentHeight/GetRotatedContentHeight: CatchInvalidFontFileExceptionand fall back to reasonable estimates (fixed char width of8, string-length-based width, andfontSizePoints * dpi / 72for height).Test corrections
TestSecondsRoundingWithoutMilliseconds: expect"02:34:08"(was"02:34:07")TestBug60031: expect"09:54:34"for 903 ms value (was"09:54:33")TestNPOI1469: truncateDateTime.UtcNowto whole seconds before writing cells, soDateTime.ToString(truncates ms) andDataFormatter(rounds ms) agreeOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.